$NG.AllReady(function (page, { useAction, useBeforeClick, useValuesChange, useClick, useUpdateRow, subscribe, useUpdateRows }) {
    const mstform = $NG.getCmpApi("p_form_xmk_m")
    const dgrid1 = $NG.getCmpApi("")
    const getHeadValue = (str)=>mstform.getItem(str).getValue()

    useValuesChange(()=>{
        getGzProjectInfo()
    },"p_form_xmk_m.u_xmmc")

    // 获取跟踪项目信息
    function getGzProjectInfo(){
        const phid = mstform.getItem("u_xmmc").getValue()
        if(!phid) return 
        $NG.execServer("getTraceProjectInfo",{phid},(res)=>{
            if(res.count == 0) return 
            const data = JSON.parse(res.data)[0].extendObjects
            const arr = [
                {
                    key:"u_ssqy",
                    value:{
                        value:data.u_scqy,
                        label:data.u_scqy_name
                    }
                },
                {
                    key:"u_jsdd",
                    value:data.sheng_name+"-"+data.city_name+"-"+data.qvxian_name
                }
            ]

            setHeadValues(arr)
        })
    }


        // 表头批量赋值
    function setHeadValues(arr) {
        arr.forEach(item => {
            console.log(`执行更新`,item);
            mstform.getItem(item.key)?.setValue(item.value)
        })
    }
})
